<#import "/spring.ftl" as spring />
<html>
<head>
</head>
<body>

<div id="content">

	<h1>COMPANY SETTINGS</h1>
	
	<p>
	Below you can customize Inspector Time to tailor to ${inspectorCompany.name}'s specific needs.  Add and edit inspectors and schedulers, update availability times, 
	modify your pricing model, and more...
	</p>
	
	<p />
	
	<!-- MY COMPANY -->
	<div class="databoxWrapper">
		<div class="databox">
			<h1>MY COMPANY</h1>
			<h2>${inspectorCompany.name?upper_case}</h2>
			<table class="databoxStandardTable">
				<tr>
					<td>${inspectorCompany.address.street1}, ${inspectorCompany.address.city}, ${inspectorCompany.address.state} ${inspectorCompany.address.zipCode}</td>
					<td class="databoxButtonsCell">
					<a href="<@spring.url "/inspector/editInspectorCompany.html?id=${inspectorCompany.id}" />" class="databoxButton">EDIT</a>
				</tr>
			</table>
		</div>					
	</div>
	<!-- /MY COMPANY -->
	
	<p />
	
	<#-- Add the inspectors and schedulers together, then 
	     separate into two columns -->
	<#assign employees = inspectorCompany.inspectors />
	<#if inspectorCompany.schedulers??>
		<#assign employees = employees + inspectorCompany.schedulers />
	</#if>
	
	<#if employees?size gt 1>
		<#assign half = (employees?size/2) />
		<#-- hack to round up (later versions of freemarker support rounding-->
		<#if (half != half?int)><#assign half = (half + 0.5) /></#if>
		<#assign column1 = employees[0..half-1] />
		<#assign column2 = employees[half..] />
	<#else>
		<#assign column1 = employees />
	</#if>
	
	<!-- MY STAFF -->	
	<div class="databoxWrapper">
		<div class="databox">
			<h1>MY STAFF</h1>
			<table class="databoxDividerTable">
				<tr>
					<td class="databoxDividerCell">
						<table class="databoxInnerTable">
						<#list column1 as employee>
							<#assign isScheduler = (inspectorCompany.schedulers?seq_contains(employee)) />
							<tr>
								<td>${employee.name} <#if isScheduler>(*)</#if></td>
								<td class="databoxButtonsCell">
								<#if isScheduler>
									<a href="<@spring.url "/inspector/editSchedulerProfile.html?id=${employee.id}" />" class="databoxButton">EDIT</a>
								<#else>
									<a href="<@spring.url "/inspector/editInspectorProfile.html?id=${employee.id}" />" class="databoxButton">EDIT</a>
									<a href="<@spring.url "/inspector/scheduleRule/viewScheduleRules.html?inspectorId=${employee.id}" />" class="databoxButton">SCHEDULE</a>
								</#if>
								</td>
							</tr>
						</#list>
						</table>
					</td>
					<td class="databoxDivider"> </td>
					<td class="databoxDividerCell">
						<#if column2??>
							<table class="databoxInnerTable">
							<#list column2 as employee>
								<#assign isScheduler = (inspectorCompany.schedulers?seq_contains(employee)) />
								<tr>
									<td>${employee.name} <#if isScheduler>(*)</#if></td>
									<td class="databoxButtonsCell">
									<#if isScheduler>
										<a href="<@spring.url "/inspector/editSchedulerProfile.html?id=${employee.id}" />" class="databoxButton">EDIT</a>
									<#else>
										<a href="<@spring.url "/inspector/editInspectorProfile.html?id=${employee.id}" />" class="databoxButton">EDIT</a>
										<a href="<@spring.url "/inspector/scheduleRule/viewScheduleRules.html?inspectorId=${employee.id}" />" class="databoxButton">SCHEDULE</a>
									</#if>
									</td>
								</tr>
							</#list>
							</table>
						</#if>
					</td>
				</tr>
			</table>
			
			<div class="databoxSubLinks">
				<a href="<@spring.url "/inspector/addInspector.html" />">Add Inspector</a>
				<a href="<@spring.url "/inspector/addScheduler.html"/>">Add Scheduler</a>
				(*) Scheduler
			</div>

		</div>					
	</div>
	<!-- /MY STAFF -->

	<!-- MY CUSTOM SETTINGS -->
	<div class="databoxWrapper">
		<div class="databox">
			<h1>MY CUSTOM SETTINGS</h1>
			<table class="databoxDividerTable">
				<tr>
					<td class="databoxDividerCell">
						<table class="databoxInnerTable">
							<tr><td>Pricing plan: <span class="settingsValue">${inspectorCompany.pricingPlanType!"BasicFlatFee"}</span></td><td class="databoxButtonsCell"><a href="<@spring.url "/inspector/fee/priceHome.html" />" class="databoxButton">EDIT</a></td></tr>
							<tr><td>Additional services: <span class="settingsValue">${inspectorCompany.optionalServices?size}</span></td><td class="databoxButtonsCell"><a href="<@spring.url "/inspector/fee/optionalServices.html" />" class="databoxButton">EDIT</a></td></tr>
							<tr><td>Max miles served: <span class="settingsValue">${inspectorCompany.maxMilesServed}</span></td><td class="databoxButtonsCell"><a href="<@spring.url "/inspector/editMilesServed.html?id=${inspectorCompany.id}" />" class="databoxButton">EDIT</a></td></tr>
							<tr><td>Realtor partners: <span class="settingsValue">${inspectorCompany.referringAgents?size}</span></td><td class="databoxButtonsCell"><a href="<@spring.url "/inspector/referringRealtors.html" />" class="databoxButton">EDIT</a></td></tr>
							<tr><td>Unpaid invoices: <span class="settingsValue">${(invoices?size)!"0"}</span></td><td class="databoxButtonsCell"><a href="<@spring.url "/inspector/billing/invoices.html" />" class="databoxButton">VIEW</a></td></tr>
						</table>
					</td>
					<td class="databoxDivider"></td>
					<td class="databoxDividerCell">
						<table class="databoxInnerTable">
							<!-- payment settings -->
							<#if inspectorCompany.paypalEnabled && inspectorCompany.simLoginId??>
								<#assign paymentsEnabled="PayPal and Credit Cards" />
							<#elseif inspectorCompany.paypalEnabled >
								<#assign paymentsEnabled="PayPal" />
							<#elseif inspectorCompany.simLoginId?? >
								<#assign paymentsEnabled="Credit Cards" />
							<#else>
								<#assign paymentsEnabled="Disabled" />
							</#if>
							<tr><td>Accept payment online: <span class="settingsValue">${paymentsEnabled}</span></td><td class="databoxButtonsCell"><a href="<@spring.url "/inspector/paymentSettings.html?id=${inspectorCompany.id}" />"  class="databoxButton">EDIT</a></td></tr>
							<tr><td>Home buyer confirmation email</td><td class="databoxButtonsCell"><a href="<@spring.url "/inspector/editEmailTemplate.html?emailTemplate.name=buyer_confirmation" />"  class="databoxButton">EDIT</a></td></tr>
							<tr><td>Realtor thank you email</td><td class="databoxButtonsCell"><a href="<@spring.url "/inspector/editEmailTemplate.html?emailTemplate.name=realtor_thank_you" />"  class="databoxButton">EDIT</a></td></tr>
							<tr><td>Your calendar, as home buyers see it</td><td class="databoxButtonsCell"><a href="<@spring.url "/inspectors/${inspectorCompany.shortName}/schedule1.html" />" target="_new" class="databoxButton">VIEW</a></td></tr>
							<tr><td>Link to your calendar from your web site</td><td class="databoxButtonsCell"><a href="<@spring.url "/inspector/promote.html" />" class="databoxButton">HOWTO</a></td></tr>
						</table>
					</td>
				</tr>
			</table>
		</div>					
	</div>
	<!-- MY CUSTOM SETTINGS -->

	<!-- LOGO -->
	<div class="databoxWrapper">
		<div class="databox">
			<h1>COMPANY LOGO <span class="databoxButtonsCell"><a href="<@spring.url "/inspector/editLogo.html" />" class="databoxButton">EDIT</a></span></h1>
			<table cellpadding="10">
			<tr>
			<#if inspectorCompany.logoImage??>
				<td><img src="<@spring.url "/inspectors/logo-image/${inspectorCompany.shortName}.html" />" /></td>
			<#else>
				<td style="font-size: 12px;">Not uploaded yet</td>
			</#if>
			</tr>
			</table>			
		</div>					
	</div>
	<!-- LOGO -->


	<!-- EMAIL -->
	<#--
	<div class="databoxWrapper">
		<div class="databox">
			<h1>EMAIL SETTINGS</h1>
			<table cellpadding="10">
			<tr>
				<td style="font-size: 12px;">Home Buyer confirmation email <span class="databoxButtonsCell"><a href="<@spring.url "/inspector/editConfirmationEmailTemplate.html" />" class="databoxButton">EDIT</a></span></td>
			</tr>
			</table>			
		</div>					
	</div>
	-->
	<!-- EMAIL -->


	<p />

</div>

</body>
</html>
